using System;

namespace AuthService.Domain.Events
{
    /// <summary>
    /// 用户登录事件
    /// </summary>
    public class UserLoginEvent
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public Guid UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; } = string.Empty;

        /// <summary>
        /// 租户ID
        /// </summary>
        public Guid? TenantId { get; set; }

        /// <summary>
        /// 会话ID
        /// </summary>
        public string SessionId { get; set; } = string.Empty;

        /// <summary>
        /// 登录时间
        /// </summary>
        public DateTime LoginTime { get; set; }

        /// <summary>
        /// IP地址
        /// </summary>
        public string IpAddress { get; set; } = string.Empty;

        /// <summary>
        /// 用户代理
        /// </summary>
        public string UserAgent { get; set; } = string.Empty;

        /// <summary>
        /// 登录设备
        /// </summary>
        public string DeviceInfo { get; set; } = string.Empty;

        /// <summary>
        /// 登录位置
        /// </summary>
        public string Location { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = string.Empty;
    }

    /// <summary>
    /// 用户登出事件
    /// </summary>
    public class UserLogoutEvent
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public Guid UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; } = string.Empty;

        /// <summary>
        /// 租户ID
        /// </summary>
        public Guid? TenantId { get; set; }

        /// <summary>
        /// 会话ID
        /// </summary>
        public string SessionId { get; set; } = string.Empty;

        /// <summary>
        /// 登出时间
        /// </summary>
        public DateTime LogoutTime { get; set; }

        /// <summary>
        /// 登出原因
        /// </summary>
        public string Reason { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = string.Empty;
    }

    /// <summary>
    /// 密码已更改事件
    /// </summary>
    public class PasswordChangedEvent
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public Guid UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; } = string.Empty;

        /// <summary>
        /// 租户ID
        /// </summary>
        public Guid? TenantId { get; set; }

        /// <summary>
        /// 更改时间
        /// </summary>
        public DateTime ChangedTime { get; set; }

        /// <summary>
        /// IP地址
        /// </summary>
        public string IpAddress { get; set; } = string.Empty;

        /// <summary>
        /// 用户代理
        /// </summary>
        public string UserAgent { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = string.Empty;
    }

    /// <summary>
    /// 令牌已撤销事件
    /// </summary>
    public class TokenRevokedEvent
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public Guid UserId { get; set; }

        /// <summary>
        /// 令牌ID
        /// </summary>
        public string TokenId { get; set; } = string.Empty;

        /// <summary>
        /// 令牌类型
        /// </summary>
        public string TokenType { get; set; } = string.Empty;

        /// <summary>
        /// 租户ID
        /// </summary>
        public Guid? TenantId { get; set; }

        /// <summary>
        /// 客户端ID
        /// </summary>
        public string ClientId { get; set; } = string.Empty;

        /// <summary>
        /// 撤销时间
        /// </summary>
        public DateTime RevokedTime { get; set; }

        /// <summary>
        /// 撤销原因
        /// </summary>
        public string Reason { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = string.Empty;
    }

    /// <summary>
    /// 安全事件触发事件
    /// </summary>
    public class SecurityEventTriggeredEvent
    {
        /// <summary>
        /// 事件ID
        /// </summary>
        public string EventId { get; set; } = string.Empty;

        /// <summary>
        /// 用户ID
        /// </summary>
        public Guid? UserId { get; set; }

        /// <summary>
        /// 租户ID
        /// </summary>
        public Guid? TenantId { get; set; }

        /// <summary>
        /// 事件类型
        /// </summary>
        public string EventType { get; set; } = string.Empty;

        /// <summary>
        /// 事件描述
        /// </summary>
        public string Description { get; set; } = string.Empty;

        /// <summary>
        /// 风险级别
        /// </summary>
        public string RiskLevel { get; set; } = "Low";

        /// <summary>
        /// 事件时间
        /// </summary>
        public DateTime EventTime { get; set; }

        /// <summary>
        /// IP地址
        /// </summary>
        public string IpAddress { get; set; } = string.Empty;

        /// <summary>
        /// 用户代理
        /// </summary>
        public string UserAgent { get; set; } = string.Empty;

        /// <summary>
        /// 是否成功
        /// </summary>
        public bool Success { get; set; }

        /// <summary>
        /// 详情
        /// </summary>
        public string Details { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = string.Empty;
    }

    /// <summary>
    /// 风险评估完成事件
    /// </summary>
    public class RiskAssessmentCompletedEvent
    {
        /// <summary>
        /// 评估ID
        /// </summary>
        public string AssessmentId { get; set; } = string.Empty;

        /// <summary>
        /// 用户ID
        /// </summary>
        public Guid UserId { get; set; }

        /// <summary>
        /// 租户ID
        /// </summary>
        public Guid? TenantId { get; set; }

        /// <summary>
        /// 操作类型
        /// </summary>
        public string ActionType { get; set; } = string.Empty;

        /// <summary>
        /// 风险分数
        /// </summary>
        public float RiskScore { get; set; }

        /// <summary>
        /// 风险级别
        /// </summary>
        public string RiskLevel { get; set; } = "Low";

        /// <summary>
        /// 是否允许
        /// </summary>
        public bool IsAllowed { get; set; }

        /// <summary>
        /// 拒绝原因
        /// </summary>
        public string RejectionReason { get; set; } = string.Empty;

        /// <summary>
        /// 评估时间
        /// </summary>
        public DateTime AssessedAt { get; set; }

        /// <summary>
        /// IP地址
        /// </summary>
        public string IpAddress { get; set; } = string.Empty;

        /// <summary>
        /// 用户代理
        /// </summary>
        public string UserAgent { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = string.Empty;
    }
}